package xwc.usertree;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;

import java.math.BigDecimal;

@AllArgsConstructor
@Getter
@ToString
public class Income {
    // 邀请人得到的10%, 30%, 60%也要加入到动态团队收益中
    private BigDecimal directIncome = BigDecimal.ZERO; // 直推收益（邀请下线后依次得到下线本次充值额的10%，30%，60%的收益）
    private BigDecimal staticIncome = BigDecimal.ZERO; // 静态分红收益
    private BigDecimal dynamicIncome = BigDecimal.ZERO; // 团队动态收益
    private BigDecimal generationIncome = BigDecimal.ZERO; // 平级代数收益（一级20%, 二级10%

    public BigDecimal getFullIncome() {
        return directIncome.add(staticIncome).add(dynamicIncome).add(generationIncome);
    }

    public Income add(BigDecimal directDelta, BigDecimal staticDelta, BigDecimal dynamicDelta, BigDecimal generationIncomeDelta) {
        return new Income(directIncome.add(directDelta), staticIncome.add(staticDelta),
                dynamicIncome.add(dynamicDelta), generationIncome.add(generationIncomeDelta));
    }
}
